#!/bin/bash

cd /home/zuwenqiang/Respo2/SimMed

export PYTHONPATH=$PWD:$PYTHONPATH



directory=Trade_off/1_table1/cka_eval/logs
if [ ! -d "$directory" ]; then
    mkdir -p "$directory"
    echo "Directory created: $directory"
else
    echo "Directory already exists: $directory"
fi


# 外层循环：改变 frozen_stages
for max_epochs in 10 20 30 40; do
    echo "Running experiments with max_epochs=$max_epochs"

    i=0
    while [ $i -lt 3 ]; do
        i=$((i+1))
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/ISIC/vit-base.py configs/full/ISIC/vit-base.py --checkpoint1 work_dirs/full/vit-base_ISIC/exp$i/epoch_$max_epochs.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/max_epochs_$max_epochs.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/APTOS/vit-base.py configs/full/APTOS/vit-base.py --checkpoint1 work_dirs/full/vit-base_APTOS/exp$i/epoch_$max_epochs.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/max_epochs_$max_epochs.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/chest/vit-base.py configs/full/chest/vit-base.py --checkpoint1 work_dirs/full/vit-base_chest/exp$i/epoch_$max_epochs.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/max_epochs_$max_epochs.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/colon/vit-base.py configs/full/colon/vit-base.py --checkpoint1 work_dirs/full/vit-base_colon/exp$i/epoch_$max_epochs.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/max_epochs_$max_epochs.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/endo/vit-base.py configs/full/endo/vit-base.py --checkpoint1 work_dirs/full/vit-base_endo/exp$i/epoch_$max_epochs.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/max_epochs_$max_epochs.log
    done
done



# 外层循环：改变 frozen_stages
for frozen_stages in 1 3 6 9; do
    echo "Running experiments with frozen_stages=$frozen_stages"

    i=0
    while [ $i -lt 3 ]; do
        i=$((i+1))
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/ISIC/vit-base.py configs/full/ISIC/vit-base.py --checkpoint1 work_dirs/full/vit-base_ISIC/exp$i/frozen_stages_$frozen_stages/epoch_50.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/frozen_stages_$frozen_stages.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/APTOS/vit-base.py configs/full/APTOS/vit-base.py --checkpoint1 work_dirs/full/vit-base_APTOS/exp$i/frozen_stages_$frozen_stages/epoch_50.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/frozen_stages_$frozen_stages.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/chest/vit-base.py configs/full/chest/vit-base.py --checkpoint1 work_dirs/full/vit-base_chest/exp$i/frozen_stages_$frozen_stages/epoch_50.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/frozen_stages_$frozen_stages.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/colon/vit-base.py configs/full/colon/vit-base.py --checkpoint1 work_dirs/full/vit-base_colon/exp$i/frozen_stages_$frozen_stages/epoch_50.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/frozen_stages_$frozen_stages.log
        CUDA_VISIBLE_DEVICES=5 python tools/CKA/example_2cft.py configs/full/endo/vit-base.py configs/full/endo/vit-base.py --checkpoint1 work_dirs/full/vit-base_endo/exp$i/frozen_stages_$frozen_stages/epoch_50.pth --checkpoint2 work_dirs/vit-base-p16_3rdparty_pt-64xb64_in1k-224_20210928-02284250.pth 1>> $directory/frozen_stages_$frozen_stages.log
    done
done